package com.example.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

@Slf4j
@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(DemoApplication.class, args);
        Environment env = application.getEnvironment();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        if (!StringUtils.hasText(path)) {
            path = "";
        }
        log.info("\n----------------------------------------------------------\n\t" +
                "项目启动成功,可通过下方链接访问:\n\t" +
                "Local访问链接: \t\thttp://localhost:" + port + path + "\n\t" +
                "----------------------------------------------------------");
    }

    /*
    *

         adaptor: function (payload, response, api, context) {
               //  console.log(payload);
               //  console.log(response);


               //  if(response.status=0){
                    // localStorage,setItem("token",payload,data.token);
                    // localStorage.setItem("xtoken",'payload.data.xtoken);
                   // location.href ="/index.html";
              //   }

               return {
                    ...payload,
                    status: payload.code === 200 ? 0 : payload.code
                  };
              }
            },
            * */

}
